import $api from '.';

interface list {
    name: string;
    [key: string]: any;
}
// 添加商品
export const addshangbiao = function (data: list) {
  // 获取orderlist的内容
  return $api.post('/orderlist', data);
};
// 获取商品列表
export const getshangbiaoList = function (data: { $limit: number; $skip: number }) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/orderlist', {
    params: data,
  });
};
// 修改
export const updateGoods = function (id: number, data: any) {
  // patch 修改
  return $api.patch(`/orderlist/${id}`, data);
};
// 删除商品
export const delshangbiao = function (id: number) {
  return $api.delete(`/orderlist/${id}`);
};
// 查询
export const getchaxun = (data: { $limit: number; $skip: number;
  name: any; }) => {
  // chaname: any 根据名称来查询
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/orderlist', {
    params: data,
  });
};

export default {};
